﻿<%@ Page Title="" Language="C#" MasterPageFile="/Common/Master.master" %>

<script runat="server">

</script>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentForm" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentHtml" Runat="Server">     
    <div class="easyui-layout tableEdit" data-options="fit:true,border:false">
        <div data-options="region:'center',border:false" id="validation" class="validationEngineContainer">
            <div class="z_wrap">
                <ul class="info">
                    <li>
                        <em class='l_name'>原始密码：</em>
                        <div class='r_con1'>
                            <input id='OldPassWord' name='OldPassWord' type='text' class='validate[required]' data-prompt-position='bottomRight' />
                        </div>
                    </li>
                    <li>
                        <em class='l_name'>新密码：</em>
                        <div class='r_con1'>
                            <input id='NewPassWord' name='NewPassWord' type='password' class='validate[required]' data-prompt-position='bottomRight' />
                        </div>
                    </li>
                    <li>
                        <em class='l_name'>密码确认：</em>
                        <div class='r_con1'>
                            <input id='NewPassWord1' name='NewPassWord1' type='password' class='validate[required]' data-prompt-position='bottomRight' />
                        </div>
                    </li> 
                </ul>
            </div>
        </div>
        <div data-options="region:'south'" style="height: 35px; border-bottom: 0px; border-left: 0px; border-right: 0px;" class="edit_bottom">
            <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-save'" id="buttonOk">确 定</a>
            <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'" onclick="$.layerClose(false);">取 消</a>
        </div>
    </div>

    <script type="text/javascript">
        jQuery('#validation').validationEngine();
        $(function () {
            $("#buttonOk").click(function () {
                InsertOrUpdate();
            });
        });

        function InsertOrUpdate() {
            var flag = false; var msg = "";
            if ($.GetValue("NewPassWord").length >= 6) {
                if ($.GetValue("NewPassWord") == $.GetValue("NewPassWord1")) {
                    flag = true;
                }
                else {
                    msg = "两次输入不一致";
                }
            }
            else {
                msg = "密码不能少于6位";
            }

            if (flag) {
                $.InvokeAjax("Login", "UpdateUserInfoPassWord", { ID: $.cookie('login_token'), OldPassWord: $.GetMd5($.GetValue("OldPassWord")), PassWord: $.GetMd5($.GetValue("NewPassWord")) }, true, function (data) {
                    obj = $.StrToJson(data).Msg; 
                    $.messager.alert('提示', obj, 'info');
                });
            }
            else {
                $.messager.alert('提示', msg, 'info');
            }
        }
    </script>
</asp:Content>
